n = input()
a = (n.split(" ")[0])
b = (n.split(" ")[1])
c = (n.split(" ")[2])
k = 0
v = 0
p = 0
d = 0
f = 0
g = 0
s = 9999999
if a == "one":
    d = "1"
elif a == "two":
    d = "2"
elif a == "three":
    d = "3"
elif a == "four":
    d = "4"
elif a == "five":
    d = "5"
elif a == "six":
    d = "6"
elif a == "seven":
    d = "7"
elif a == "eight":
    d = "8"
elif a == "nine":
    d = "9"
else:
    print("Wrong input")
if b == "one":
    f = "1"
elif b == "two":
    f = "2"
elif b == "three":
    f = "3"
elif b == "four":
    f = "4"
elif b == "five":
    f = "5"
elif b == "six":
    f = "6"
elif b == "seven":
    f = "7"
elif b == "eight":
    f = "8"
elif b == "nine":
    f = "9"
else:
    print("Wrong input")
if c == "one":
    g = "1"
elif c == "two":
    g = "2"
elif c == "three":
    g = "3"
elif c == "four":
    g = "4"
elif c == "five":
    g = "5"
elif c == "six":
    g = "6"
elif c == "seven":
    g = "7"
elif c == "eight":
    g = "8"
elif c == "nine":
    g = "9"
else:
    print("Wrong input")
p = d + f + g
print(int(p))
v = int(p)
for i in range (1,v+1):
    for j in range (1,i+1):
        if i % j == 0 and v - i < s:
            k = k + 1
    if k == 2:
        s = i
    else:
        k = 0
print(s)
